<template>
    <div>
        <el-form label-width="180px">
            <el-form-item label="三合一营业执照：" v-if="imgList.business_license">
                <el-image class="img-style" :src="imgList.business_license"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('UNIFIED_CODE_CERTIFICATE',imgList.business_license)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="开户许可证：" v-if="imgList.opening_account">
                <el-image class="img-style" :src="imgList.opening_account"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('PERMIT_FOR_BANK_ACCOUNT',imgList.opening_account)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="法人身份证正面" v-if="imgList.front_card">
                <el-image class="img-style" :src="imgList.front_card"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('FRONT_OF_ID_CARD',imgList.front_card)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="法人身份证反面：" v-if="imgList.back_card">
                <el-image class="img-style" :src="imgList.back_card"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('BACK_OF_ID_CARD',imgList.back_card)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="手持身份证照" v-if="imgList.handheld_card">
                <el-image class="img-style" :src="imgList.handheld_card"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('HANDHELD_OF_ID_CARD',imgList.handheld_card)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="手持银行卡照" v-if="imgList.handheld_bank">
                <el-image class="img-style" :src="imgList.handheld_bank"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('HANDHELD_OF_BANK_CARD',imgList.handheld_bank)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="室内照" v-if="imgList.interior_photo">
                <el-image class="img-style" :src="imgList.interior_photo"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('INTERIOR_PHOTO',imgList.interior_photo)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="结算卡照" v-if="imgList.bank_card">
                <el-image class="img-style" :src="imgList.bank_card"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('BANK_CARD',imgList.bank_card)">传至渠道</el-button>
                </div>
            </el-form-item>
            <el-form-item label="门头照" v-if="imgList.sign_doard">
                <el-image class="img-style" :src="imgList.sign_doard"></el-image>
                <div>
                    <el-button type="primary" size="mini" @click="upToChannel('SIGN_BOARD',imgList.sign_doard)">传至渠道</el-button>
                </div>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
export default {
    props: {
        imgList: Object,
        id: Number
    },
    data() {
        return {
            loading: false
        }
    },
    created() {
    },
    methods: {
        upToChannel(field, url) {
            let _this = this;
            this.$emit("setLoadingStatus",true);
            this.$axios({
                url: '/admin/channel/other',
                data: {
                    type: 1,
                    userID: _this.id,
                    genre: 3,
                    path: url,
                    imgType: field
                },
                success(res) {
                    _this.$emit("setLoadingStatus",false)
                    if (res.data.code == 200) {
                        _this.$message({
                            message: res.data.msg,
                            type: 'success'
                        });
                    } else {
                        _this.$message.error(res.data.msg);
                    }
                }
            });
        }
    }
}
</script>
<style scoped>
.el-form-item {
    width: 50%;
    float: left;
}
.img-style {
    width: 200px;
    height: 100px;
}
</style>